﻿///////////////////////////////////////////////////////////////////////////////
//
//  This source is part of the  "Managed Task Framework.NET Runtime"  (MTF.NET Runtime).
//
//
//  Copyright (c) 2011, Multicore Consulting Limited (UK)
//  All rights reserved.
//  http://www.multicoreconsulting.co.uk
//
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions
//  are met:
//
//  -  Redistributions of source code must retain the above copyright
//     notice, this list of conditions and the following disclaimer.
//  -  Redistributions in binary form must reproduce the above copyright
//     notice, this list of conditions and the following disclaimer in
//     the documentation and/or other materials provided with the
//     distribution.
//  -  Neither the name of Multicore Consulting Limited nor the names of
//     its contributors may be used to endorse or promote products
//     derived from this software without specific prior written
//     permission.
//
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
//  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
//  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
//  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
//  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
//  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
//  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
//  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
//  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
//  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//  POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace MTFOrg.MTF.MTFRuntime
{
    public enum PropertyType
    {
        NORMAL,
        CODE,
        RESOURCE
    }

    public class IsConcurrentTask : Attribute
    {
        protected string m_ImageResource;
        protected bool m_IsRequestable;
        protected string m_Version;
        protected string m_Title;

        public IsConcurrentTask(string imageResource, bool isRequestable, string version, string title)
        {
            m_ImageResource = imageResource;
            m_IsRequestable = isRequestable;
            m_Version = version;
            m_Title = title;
        }

        public string ImageResource
        {
            get { return m_ImageResource; }
        }

        public bool IsRequestable
        {
            get { return m_IsRequestable; }
        }

        public string Version
        {
            get { return m_Version; }
        }

        public string Title
        {
            get { return m_Title; }
        }
    }

    public class IsConcurrentFunction : Attribute
    {
    }

    public class IsPropertyEnumeration : Attribute
    {
    }

    public class IsConnectionPointDefinition : Attribute
    {
        /// <summary>
        /// Type of this connection point's base
        /// </summary>
        protected string m_BaseType;

        /// <summary>
        /// Specifies whether the connection point instance should be anchored
        /// at a specific angle.
        /// </summary>
        protected bool m_IsAnchored;

        /// <summary>
        /// Angle to anchor connection point instance at.
        /// </summary>
        protected double m_Angle;

        /// <summary>
        /// Condition for displaying an incoming filled arrow.
        /// </summary>
        protected string m_FilledArrowIn;

        /// <summary>
        /// Condition for displaying an outgoing filled arrow.
        /// </summary>
        protected string m_FilledArrowOut;

        /// <summary>
        /// List of provisions provided by this connection point.
        /// </summary>
        protected string m_Provisions;

        /// <summary>
        /// List of requirements stipulated by this connection point.
        /// </summary>
        protected string m_Requirements;

        /// <summary>
        /// Conditon for displaying a dashed line for the connection connected to the connection point.
        /// </summary>
        protected string m_DashedLine;

        /// <summary>
        /// Stroke colour used for drawing the connection point/bar shape. 
        /// </summary>
        protected string m_StrokeColour;

        /// <summary>
        /// Fill colour used for drawing the connection point/bar shape. 
        /// </summary>
        protected string m_FillColour;

        /// <summary>
        /// Dimensionality associated with the connection point/bar.
        /// </summary>
        protected string m_Dimensions;

        /// <summary>
        /// Specifies whether or not to display the name in the connection point/bar title.
        /// </summary>
        protected bool m_ShowName;

        /// <summary>
        /// Title conditional descriptor of this connection point.
        /// </summary>
        protected string m_Title;

        /// <summary>
        /// Gets the type of this connection point's base
        /// </summary>
        public string BaseType
        {
            get { return m_BaseType; }
        }

        /// <summary>
        /// Gets whether the connection point instance should be anchored
        /// at a specific angle.
        /// </summary>
        public bool IsAnchored
        {
            get { return m_IsAnchored; }
        }

        /// <summary>
        /// Gets the angle to anchor connection point instance at.
        /// </summary>
        public double Angle
        {
            get { return m_Angle; }
        }

        /// <summary>
        /// Gets the condition for displaying an incoming filled arrow.
        /// </summary>
        public string FilledArrowIn
        {
            get { return m_FilledArrowIn; }
        }

        /// <summary>
        /// Gets the condition for displaying an outgoing filled arrow.
        /// </summary>
        public string FilledArrowOut
        {
            get { return m_FilledArrowOut; }
        }

        /// <summary>
        /// Gets the list of provisions provided by this connection point.
        /// </summary>
        public string Provisions
        {
            get { return m_Provisions; }
        }

        /// <summary>
        /// Gets the list of requirements stipulated by this connection point.
        /// </summary>
        public string Requirements
        {
            get { return m_Requirements; }
        }

        /// <summary>
        /// Gets the condition for displaying a dashed line for the connection connected to the connection point.
        /// </summary>
        public string DashedLine
        {
            get { return m_DashedLine; }
        }

        /// <summary>
        /// Gets the stroke colour used for drawing the connection point/bar shape. 
        /// </summary>
        public string StrokeColour
        {
            get { return m_StrokeColour; }
        }

        /// <summary>
        /// Gets the fill colour used for drawing the connection point/bar shape. 
        /// </summary>
        public string FillColour
        {
            get { return m_FillColour; }
        }

        /// <summary>
        /// Gets the dimensions associated with this connection point/bar shape.
        /// </summary>
        public string Dimensions
        {
            get { return m_Dimensions; }
        }

        /// <summary>
        /// Gets a valaue that specifies whether or not to display the name in the connection point/bar title.
        /// </summary>
        public bool ShowName
        {
            get { return m_ShowName; }
        }

        /// <summary>
        /// Gets the title conditional descriptor for this connection point.
        /// </summary>
        public string Title
        {
            get { return m_Title; }
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="baseType">Base type</param>
        /// <param name="isAnchored">Whether connection point instance is anchored</param>
        /// <param name="angle">Angle to anchor connection point instance at</param>
        /// <param name="filledArrowIn">Condition for displaying a filled incoming arrow</param>
        /// <param name="filledArrowOut">Condition for displaying a filled outgoing arrow</param>
        /// <param name="provisions">List of provisions provided by this connection point</param>
        /// <param name="requirements">List of requirements stipulated by this connection point</param>
        /// <param name="dashedLine">Conditon for displaying a dashed line for a connection line connected to the connection point.</param>
        /// <param name="strokeColour">Stroke colour used to draw the connection point/bar.</param>
        /// <param name="fillColour">Fill colour used to draw the connection point/bar.</param>
        /// <param name="dimensions">Dimensionality of the connection point/bar.</param>
        /// <param name="showName">Specifies whether or not to display the name in the title of the connection point/bar.</param>
        /// <param name="title"> The conditional descriptor for the title of the connection point</param> 
        public IsConnectionPointDefinition(string baseType, bool isAnchored, double angle, string filledArrowIn, string filledArrowOut, string provisions, string requirements, string dashedLine, string strokeColour, string fillColour, string dimensions, bool showName, string title)
        {
            m_BaseType = baseType;
            m_IsAnchored = isAnchored;
            m_Angle = angle;
            m_FilledArrowIn = filledArrowIn;
            m_FilledArrowOut = filledArrowOut;
            m_Provisions = provisions;
            m_Requirements = requirements;
            m_DashedLine = dashedLine;
            m_StrokeColour = strokeColour;
            m_FillColour = fillColour;
            m_Dimensions = dimensions;
            m_ShowName = showName;
            m_Title = title;
        }
    }

    public class IsTaskProperties : Attribute
    {
    }

    /// <summary>
    /// Property definition meta-data attribute.
    /// </summary>
    public class IsPropertyDefinition : Attribute
    {
        /// <summary>
        /// Default value.
        /// </summary>
        protected string m_DefaultValue;

        /// <summary>
        /// String representing the property type.
        /// </summary>
        protected string m_Type;

        /// <summary>
        /// Category in which the property is placed.
        /// </summary>
        protected string m_Category;

        /// <summary>
        /// Description of the property.
        /// </summary>
        protected string m_Description;

        /// <summary>
        /// Friendly display name for the property.
        /// </summary>
        protected string m_DisplayName;

        /// <summary>
        /// Specifies whether this is the primary code generation item.
        /// </summary>
        protected bool m_IsPrimary;

        /// <summary>
        /// Code template for code generation properties.
        /// </summary>
        protected string m_CodeTemplate;

        /// <summary>
        /// Validation syntax string.
        /// </summary>
        protected string m_Syntax;

        /// <summary>
        /// Specifies the type of property definition.
        /// </summary>
        protected PropertyType m_PropertyType;

        /// <summary>
        /// Gets the default value.
        /// </summary>
        public string DefaultValue
        {
            get { return m_DefaultValue; }
        }

        /// <summary>
        /// Gets the property type.
        /// </summary>
        public string Type
        {
            get { return m_Type; }
        }

        /// <summary>
        /// Gets the category.
        /// </summary>
        public string Category
        {
            get { return m_Category; }
        }

        /// <summary>
        /// Gets the description.
        /// </summary>
        public string Description
        {
            get { return m_Description; }
        }

        /// <summary>
        /// Gets the display name.
        /// </summary>
        public string DisplayName
        {
            get { return m_DisplayName; }
        }

        /// <summary>
        /// Gets whether this is the primary code generation item.
        /// </summary>
        public bool IsPrimary
        {
            get { return m_IsPrimary; }
        }

        /// <summary>
        /// Gets the code generation template for this property.
        /// </summary>
        public string CodeTemplate
        {
            get { return m_CodeTemplate; }
        }

        /// <summary>
        /// Gets the validation syntax string.
        /// </summary>
        public string Syntax
        {
            get { return m_Syntax; }
        }

        /// <summary>
        /// Gets the property definition type. 
        /// </summary>
        public PropertyType PropertyType
        {
            get { return m_PropertyType; }
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="type">Property type</param>
        /// <param name="defaultValue">Default value</param>
        /// <param name="category">Category</param>
        /// <param name="description">Description</param>
        /// <param name="displayName">Display name</param>
        /// <param name="isPrimary">Whether this is the primary code generation item</param>
        /// <param name="codeTemplate">Code template</param>
        /// <param name="syntax">Validation syntax string</param>
        /// <param name="propertyType">Property definition type</param>
        public IsPropertyDefinition(string type, string defaultValue, string category, string description, string displayName, bool isPrimary, string codeTemplate, string syntax, PropertyType propertyType)
        {
            m_DefaultValue = defaultValue;
            m_Type = type;
            m_Category = category;
            m_Description = description;
            m_DisplayName = displayName;
            m_IsPrimary = isPrimary;
            m_CodeTemplate = codeTemplate;
            m_Syntax = syntax;
            m_PropertyType = propertyType;
        }
    }
}
